<?php
if(isset($_POST["act2"]))
{
	$noidung = stripslashes($_POST['noidung']);
	$ghichu=$_POST["ghichu"];
	$sql="insert into tintuc(noidung,ghichu) values ('$noidung','$ghichu')";
//	echo "$sql<hr>";
	$kq=mysql_query($sql);
	if(!$kq){
		echo "<script>alert('Có lỗi SQL! Nhập lại!');</script>";		
	}
	else {
		$n=mysql_affected_rows();
		echo "<script>alert('Đã thêm $n nội dung!');window.location='?m=tintuc'</script>";
	}	
}

?>

<?php
	include("connect.php");
	function print_option($sql)
	{
		$kq=mysql_query($sql);
		while ($r=mysql_fetch_array($kq))
			echo "<option value=$r[0]> $r[1] </option>";
	}
?>
<?php
include("fckeditor/fckeditor.php") ;
?>
<table width="960" height="70" border="0" cellspacing="0" cellpadding="0" bgcolor="#fbfbfb" bordercolordark="#FFFFFF">
	  <tr>
      	<td style="padding:1px solid #CCCCC">
        <div align="left" style="color:#0B55C4; font-family:Tahoma; font-size: 16px; font-weight:bold; padding-left:20px">TIN TỨC - KHUYẾN MÃI
      	</div></td>      	
      </tr>
    </table>
<table width="960" border="0" cellspacing="0" cellpadding="0">
<form method="post" onsubmit="return tintuc_insert(noidung.value,ghichu.value)">
  <tr>
    <td colspan="2" class="tieude" align="center">THÊM NỘI DUNG TIN</td>
  </tr>    
  <tr>
    <td style="padding-left:80px">Nội dung: </td>   
  	<td align="center">
    <?php
	$oFCKeditor = new FCKeditor('noidung') ;
	$oFCKeditor->BasePath = 'fckeditor/' ;
	$oFCKeditor->Value = '' ;
	$oFCKeditor->Create() ;
	?>
    </td>
  </tr>  
  <tr>
    <td style="padding-left:80px" height="30" width="110">Trạng thái:</td>
    <td align="left">   
    <select name="ghichu" style="width:240x">
	<option value="chonmenu">--------Chọn-------</option>
  	<option value="hienthi">Hiển thị</option>
	<option value="khonghienthi">Không hiển thị</option>
    </select>
    </td>
  </tr>  
  <tr>
  	<td bgcolor="#2d94ff" align="center" colspan="2" height="35">
    <input name="" type="submit" value="Thêm" class="button" onmouseover="style.background='url(../images/button-2-o.gif)'" onmouseout="style.background='url(../images/button-o.gif)'">
    <input name="" type="reset" value="Xóa trắng" class="button" onmouseover="style.background='url(../images/button-2-o.gif)'" onmouseout="style.background='url(../images/button-o.gif)'">    
    </td>
  </tr>
  <input type="hidden" name="act2">
  </form>
</table>
